﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;


namespace MainThreadMoudle
{
    public abstract class ThreadBase
    {
        public bool IsEnable { set => SetEnable(value); get => GetEnable(); }
        public string ID { protected set; get; }

        private bool isEnable = true;


        #region "Monobehavior"
        protected virtual void OnEnable() { }
        protected virtual void OnDisable(){ }
        public virtual void Start(){ }
        public virtual void Update(){ }
        #endregion

        private void SetEnable(bool value)
        {
            OnEnable();
            IsEnable = value;
        }

        private bool GetEnable()
        {
            OnDisable();
            return isEnable;
        }

        public ThreadBase(string id) => ID = id;
    }
}
